import java.util.InputMismatchException;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {

        try(Scanner scanner = new Scanner(System.in)){
            int a = scanner.nextInt();
        }catch (InputMismatchException i){
            System.out.println("捕捉到了InputMismatchException异常");
            i.printStackTrace();
        }//finally {
            //System.out.println("finally执行了");
            //scanner.close();
        //}
    }
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        try{
            int a = scanner.nextInt();
        }catch (InputMismatchException i){
            System.out.println("捕捉到了InputMismatchException异常");
            i.printStackTrace();
        }finally {
            System.out.println("finally执行了");
            scanner.close();
        }
    }
    public static void main1(String[] args) {
        try {
            int[] array = {1, 2, 3, 4, 5};
            array[100] = 100;
        } catch (NullPointerException nullPointerException) {
            nullPointerException.printStackTrace();
        } catch (ArrayIndexOutOfBoundsException a) {
            a.printStackTrace();
        } catch (RuntimeException runtimeException) {
            runtimeException.printStackTrace();
        }finally {
            System.out.println("finally被执行了....");
        }
    }
}
